package com.phone580.app.receiver;

import com.phone580.app.MainApplication;
import com.phone580.app.untilty.CommonUtility;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiManager;

public class NetworkStatusReceiver extends BroadcastReceiver {
	private MainApplication app;
	
	public NetworkStatusReceiver(Context context) {
		this.app = (MainApplication)context;
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		 if(intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)){
				boolean status = CommonUtility.isNetworkConnected(context);
				System.out.println("网络状态改变" + "--------" + status);
				if (!status) {
					app.pauseAllDownload();
				}
		 }
	}

}
